package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ActivityType;
import com.api.shopapi.entity.dto.ComplaintDTO;
import com.api.shopapi.mapper.ActivityTypeMapper;
import com.api.shopapi.service.ActivityTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("ActivityTypeServiceImplOne")
public class ActivityTypeServiceImpl implements ActivityTypeService {

    @Autowired
    private ActivityTypeMapper activityTypeMapper;

    @Override
    public
    int insert(ActivityType activityType){
        return activityTypeMapper.insert(activityType);
    }


    @Override
    public
    int delete( String activityTypeCode){
        return activityTypeMapper.delete(activityTypeCode);
    }


    @Override
    public
    int update(ActivityType activityType){
        return activityTypeMapper.update(activityType);
    }


    @Override
    public
    ActivityType getByActivityTypeCode( String activityTypeCode){
        return activityTypeMapper.getByActivityTypeCode(activityTypeCode);
    }


    @Override
    public
    List<ActivityType> listByCommandCenterCode(String commandCenterCode){
        return activityTypeMapper.listByCommandCenterCode(commandCenterCode);
    }



    @Override
    public
    PageInfo<ActivityType> pageByCommandCenterCode(int pageIndex, int pageSize, String commandCenterCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<ActivityType> list =activityTypeMapper.listByCommandCenterCode(commandCenterCode);
        return new PageInfo<>(list);
    }




}
